function Keypad(_did, _callback) {
	if(!_did){
		alert('Cannot make Keypad without div id');
		return null;
	}else{
		var el=document.getElementById(_did);
		if(el===null) {
			alert(_did+' does not exist');
			return null;
		}
	}
	var me=this;
	var callback=_callback;
	var did=_did;
	var kpid=did+'-id';
	this.enabled=true;
	this.setEnabled=function(enabled) {
		me.enabled=enabled;
		var cl='keypad';
		if(!enabled){
			cl+='-disabled';
		}
		var el=document.getElementById(kpid);
		el.className=cl;
	}
	this.callbackDelegate=function(e) {
		if(!me.enabled)return false;
		if (!e) var e = window.event;
		var targ;
		if (e.target) {
			targ = e.target;
		} else if (e.srcElement) {
			targ = e.srcElement;
		}
		alert('targ.val: '+targ.val);
		var val=targ.val;
		callback(val);
		return false; // this disables the link from being followed on click
	};
	this.mkli=function(cls,val){
		var li=document.createElement('li');
		li.className=cls;
		var a=document.createElement('a');
		a.onclick=me.callbackDelegate;
		a.href='';
		a.val=val;
		li.appendChild(a);
		return li;
	};
	this.init=function() {
		var el=document.getElementById(_did);
		var ul=document.createElement('ul');
		ul.id = kpid;
		ul.className='keypad';
		ul.appendChild(me.mkli('keypad-1','1'));
		ul.appendChild(me.mkli('keypad-2','2'));
		ul.appendChild(me.mkli('keypad-3','3'));
		ul.appendChild(me.mkli('keypad-4','4'));
		ul.appendChild(me.mkli('keypad-5','5'));
		ul.appendChild(me.mkli('keypad-6','6'));
		ul.appendChild(me.mkli('keypad-7','7'));
		ul.appendChild(me.mkli('keypad-8','8'));
		ul.appendChild(me.mkli('keypad-9','9'));
		ul.appendChild(me.mkli('keypad-0','0'));
		ul.appendChild(me.mkli('keypad-decimal','.'));
//		ul.appendChild(me.mkli('keypad-blank',''));
		el.appendChild(ul);
		var kp=document.getElementById(kpid);
		var lis = kp.getElementsByTagName('a');
	}
	me.init();
	me.setEnabled(me.enabled);
}
